#include "vidioo.h"

void cameraOpenSave()
{
	VideoCapture cap(0);
	int width = cap.get(CAP_PROP_FRAME_WIDTH);
	int height = cap.get(CAP_PROP_FRAME_HEIGHT);
	int fps = cap.get(CAP_PROP_FPS);
	VideoWriter writer("out.mp4", cap.get(CAP_PROP_FOURCC),fps,Size(width,height),true);
	Mat frame;
	while (true) {
		cap.read(frame);
		
		if (frame.empty()) {
			break;
		}
		imshow("frame",frame);
		writer.write(frame);
		int c = waitKey(50);
		if (c == 27) {
			break;
		}
	} 
	writer.release();
	cap.release();
}
